<!DOCTYPE html>
<html>
    <head>
        <title>测试</title>
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" charset="UTF-8"/>
            <style type="text/css">
                *{
                    margin:  0;
                    padding: 0;
                }
            .box{
                text-align: center;
            }
            .btn{
                line-height: 44px;
                text-align: center;
                font-size: 14px;
                border: 1px solid blue;
                background-color: #fff;
                margin-bottom: 20px;
                padding: 0 10px;
            }
            .message{
                position: fixed;
                bottom: 0;
                width: 100%;
                padding: 10px;
                font-size: 14px;
                color: #000;
            }
            </style>
        <script type="text/javascript" src="../js/autoQR.js"></script>
        <script src="../js/vconsole.min.js"></script>
        <script>
        // 初始化
        var vConsole = new VConsole();
        console.log('init vConsole');
        </script>
    </head>
    <body onload="onloadFinish()">
        <div class="box">
            <div class="message" id="message"></div>
            <button class="btn" id="J_APIMethod" onclick="jumpGoodList();">跳转到商品列表</button><br/>
            <button class="btn" id="J_APIMethod" onclick="jumpGoodDetail();">跳转到商品详情</button><br/>
        </div>
        <script>

            function onloadFinish()
            {
<!--                alert("onload");-->
<!--                if(confirm("确定点击吗？")){-->
<!--                     alert("恭喜点击成功")-->
<!--                }-->

<!--                var text = prompt("请输入");-->
<!--                if(text){-->
<!--                    alert("输入的内容为："+ text)-->
<!--                }-->
<!--                -->
<!--                var console = {};-->
<!--                console.log = function(message){window.webkit.messageHandlers['logger'].postMessage(message)};-->
                console.log("test js console.log");

                window.JXBJSBridge.call({
                                         target : "h5",
                                         action : "onload",
                                         data : {"unreadCount":"20", "content":"这里是内容~"},
                                         callback : {
                                          fromNative : fromNativeInfo,
                                          finish : function(result){document.getElementById('message').innerHTML = "finish";},
                                         }
                                     });
            }

            function jumpGoodList() {

            window.JXBJSBridge.call({
                           target : "Good",
                           action : "list",
                           data : {"unreadCount":"20", "content":"这里是内容~"},
                           callback : {
                            fromNative : fromNativeInfo,
                            finish : function(result){document.getElementById('message').innerHTML = "finish";},
                           }
                       });
        }

        function fromNativeInfo(info)
        {
            document.getElementById('message').innerHTML = info;
            console.log("recv"+info);
        }

        function jumpGoodDetail() {
            window.JXBJSBridge.call({
                target : "Good",
                action : "detail",
                data : {"id":"100"}
            });
        }

        </script>
    </body>
</html>
